04. Case Study: Unit Testing
JAVA C2 L8 04 Demo - Unit Testing
The code can be cloned from GitLab.
REST API Components
- Controller - LocationController.java
- Service - LocationService.java and LocationServiceImpl.java
- CRUD Repository - LocationRepository.java
- Domain Entity/Model - Location.java
- H2 Database accessible via http://localhost:8080/h2/
- Tomcat Server accessible via http://localhost:8080
Unit Testing Components
- LocationControllerUnitTest.java
Integration Testing Components
- LocationControllerIntegrationTest.java
Unit vs. Integration Tests
QUIZ QUESTION::
Match the below descriptions to whether they are unit tests or integration tests.
ANSWER CHOICES:
Test description |
Test Type |
---|---|
Integration |
|
Integration |
|
Unit |
|
Unit |
SOLUTION:
Test description |
Test Type |
---|---|
Integration |
|
Integration |
|
Unit |
|
Unit |
|
Unit |
|
Unit |